﻿
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;

using System.Xml.Linq;
using System.Collections.Generic;
namespace NOAH.CMS.Repository
{
    public class NewsCategoryRepository : Repository<NewsCategory>
    {
        /// <summary>
        /// Lấy toàn bộ danh mục sản phẩm theo ID parent
        /// </summary>
        /// <param name="parentID">ParentID</param>
        /// <returns></returns>
        public List<NewsCategory> GetListByParentID(int parentID)
        {
            return dataContext.NewsCategories.Where(x => x.ParentId == parentID).ToList();

        }


        public void GetRecID(int id, ref List<int> listID)
        {
            listID.Add(id);

            List<NewsCategory> listChildren = GetListByParentID(id);
            foreach (NewsCategory proCate in listChildren)
            {
                GetRecID(proCate.ID, ref listID);
            }
           
        }

        


    }
}

